const express = require('express')
const router = express.Router()
const multer = require('multer')
const upload = multer({
  dest: __dirname + '/../uploads'
})

router.post('/upload', upload.single('file'), async (req, res) => {
  const file = res.req.file
  file.url = `http://127.0.0.1:9090/uploads/${file.filename}`
  res.send(file)
})

module.exports = router